package com.ruoyi.project.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.examination.util.SnowflakeIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mapper.A06PubBannerMapper;
import com.ruoyi.project.domain.A06PubBanner;
import com.ruoyi.project.service.IA06PubBannerService;

/**
 * 轮播图Service业务层处理
 * 
 * @author WorrilessGo
 * @date 2025-11-18
 */
@Service
public class A06PubBannerServiceImpl implements IA06PubBannerService 
{
    @Autowired
    private A06PubBannerMapper a06PubBannerMapper;

    /**
     * 查询轮播图
     * 
     * @param pubBannerId 轮播图主键
     * @return 轮播图
     */
    @Override
    public A06PubBanner selectA06PubBannerByPubBannerId(String pubBannerId)
    {
        return a06PubBannerMapper.selectA06PubBannerByPubBannerId(pubBannerId);
    }

    /**
     * 查询轮播图列表
     * 
     * @param a06PubBanner 轮播图
     * @return 轮播图
     */
    @Override
    public List<A06PubBanner> selectA06PubBannerList(A06PubBanner a06PubBanner)
    {
        return a06PubBannerMapper.selectA06PubBannerList(a06PubBanner);
    }

    /**
     * 新增轮播图
     * 
     * @param a06PubBanner 轮播图
     * @return 结果
     */
    @Override
    public int insertA06PubBanner(A06PubBanner a06PubBanner)
    {
        a06PubBanner.setCreateTime(DateUtils.getNowDate());
        String id = String.valueOf(new SnowflakeIdUtils(5, 8).nextId());
        a06PubBanner.setPubBannerId(id);
        a06PubBanner.setCreateBy(SecurityUtils.getUsername());
        return a06PubBannerMapper.insertA06PubBanner(a06PubBanner);
    }

    /**
     * 修改轮播图
     * 
     * @param a06PubBanner 轮播图
     * @return 结果
     */
    @Override
    public int updateA06PubBanner(A06PubBanner a06PubBanner)
    {
        a06PubBanner.setUpdateTime(DateUtils.getNowDate());
        a06PubBanner.setUpdateBy(SecurityUtils.getUsername());
        return a06PubBannerMapper.updateA06PubBanner(a06PubBanner);
    }

    /**
     * 批量删除轮播图
     * 
     * @param pubBannerIds 需要删除的轮播图主键
     * @return 结果
     */
    @Override
    public int deleteA06PubBannerByPubBannerIds(String[] pubBannerIds)
    {
        return a06PubBannerMapper.deleteA06PubBannerByPubBannerIds(pubBannerIds);
    }

    /**
     * 删除轮播图信息
     * 
     * @param pubBannerId 轮播图主键
     * @return 结果
     */
    @Override
    public int deleteA06PubBannerByPubBannerId(String pubBannerId)
    {
        return a06PubBannerMapper.deleteA06PubBannerByPubBannerId(pubBannerId);
    }
}
